﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace GUI_QLSV
{
    public partial class LogIn : UserControl
    {        
        
        public LogIn()
        {
            
            InitializeComponent();
            label_error.Hide();
            if (CGUI_Global.is_LogIn_success)
            {
                groupBox_login.Hide();
                groupBox_logout.Show();
            }
            else
            {
                groupBox_login.Show();
                groupBox_logout.Hide();
            }
        }

        private void button_DangNhap_Click(object sender, EventArgs e)
        {
           // CGUI_Global.is_LogIn_success = true;
            if (String.IsNullOrEmpty(textBox_username.Text) == false)
                CGUI_Global.str_username = textBox_username.Text;
            if (textBox_password.Text.CompareTo("123456") == 0)
            {
                CGUI_Global.is_LogIn_success = true;
                CGUI_Global.str_username = label_username.Text = textBox_username.Text;
                label_error.Hide();
                groupBox_login.Hide();
                groupBox_logout.Show();
            }
            else
            {
                label_error.Show();                
            }
        }

        private void button_logout_Click(object sender, EventArgs e)
        {
            CGUI_Global.is_LogIn_success = false;
            CGUI_Global.str_username = label_username.Text = "";
            groupBox_login.Show();
            groupBox_logout.Hide();
            
        }

       
    }
}
